package com.example.panda;

import android.app.Activity;
import android.os.Bundle;
import android.widget.GridView;

import androidx.annotation.Nullable;

import com.example.panda.adapter.JoinTeamGridAdapter;
import com.example.panda.Item.JoinTeamGridItem;

import java.util.ArrayList;
import java.util.List;

public class JoinTeamGridViewActivity extends Activity {
    private List<JoinTeamGridItem> items = new ArrayList<JoinTeamGridItem>();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.join_team_gridview_activity);
        init();
        JoinTeamGridAdapter adapter =new JoinTeamGridAdapter(JoinTeamGridViewActivity.this,R.layout.join_team_grid_item,items);
        GridView gridView = findViewById(R.id.grid_view);
        gridView.setAdapter(adapter);
    }

    private void init(){
        JoinTeamGridItem item1 = new JoinTeamGridItem(R.color.yellow,R.drawable.zudui,R.string.zudui1);
        items.add(item1);
        JoinTeamGridItem item2 = new JoinTeamGridItem(R.color.orange,R.drawable.zudui,R.string.zudui2);
        items.add(item2);
        JoinTeamGridItem item3 = new JoinTeamGridItem(R.color.chartreuse,R.drawable.zudui,R.string.zudui3);
        items.add(item3);
        JoinTeamGridItem item4 = new JoinTeamGridItem(R.color.cyan,R.drawable.zudui,R.string.zudui4);
        items.add(item4);
    }
}
